<%@ page import="entity.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="common/tag.jsp" %>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>

    <!-- Custom Theme files -->
    <link href="https://cdn.bootcss.com/twitter-bootstrap/4.2.1/css/bootstrap.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/resource/css/style2.css" rel="stylesheet" type="text/css"
          media="all"/>
    <title>文章编辑器</title>
    <style>
        .form-group {
            border: 1px solid #F2F3F6;
            display: inline-block;
            width: 80%;
            margin-bottom: 0;
        }
        .form-group label {
            line-height: 34px;
            width: 5%;
            float: left;
            padding-left: 5px;
            margin-bottom: 0;
        }
        .form-group input, .form-group input:focus {
            border: none;
            padding: 0;
            width: 80%;
            float: left;
            height: 6%;
        }
        h4 {
            font-size: 24px;
            color: #a2a2a2;
            font-weight: 300;
        }
        .btn-theme {
            color: #fff;
            background-color: #4ECDC4;
            border-color: #48bcb4;
        }

        /*按钮样式*/
        ul.top-menu > li > .logout {
            color: #f2f2f2;
            font-size: 12px;
            border-radius: 4px;
            -webkit-border-radius: 4px;
            border: 1px solid #64c3c2 !important;
            padding: 5px 15px;
            margin-right: 15px;
            background: #4ECDC4;
            margin-top: 15px;
        }
    </style>
</head>
<body>
<jsp:include page="common/head1.jsp"/>
<div class="col-md-4 right_column" style="margin-left: 60px">
    <div class="item2">

        <ul style="list-style: none">
            <c:if test='${sessionScope.user.userType==2}'>
                <li style="float: left"><a href="${pageContext.request.contextPath}/new/adminIndex.html">管理首页</a></li>
            </c:if>
            <c:if test='${sessionScope.user.userType==0||sessionScope.user.userType==1}'>
                <li style="float: left"><a href="${pageContext.request.contextPath}/user/index.html">首页</a></li>
                <li style="float: left"><a href="${pageContext.request.contextPath}/user/center.html">我发表的文章和评论</a></li>
            </c:if>
<%--            <li style="float: left"><a href="${pageContext.request.contextPath}/user/index.html">首页</a></li>--%>
<%--            <li style="float: left"><a href="${pageContext.request.contextPath}/user/center.html">我发表的文章和评论</a></li>--%>
            <%--            <li style="float: left"><a href="#">我发表的文章和评论</a></li>--%>
        </ul>
    </div>
</div>
<div class="clearfix"></div>
<h4 style="margin-left: 100px;margin-top: 10px">${title}修改新闻</h4>

<div style="margin: 50px 150px 200px">
    <%
        User user=(User)session.getAttribute("user");
    %>

    <span>${updateResult.errMes}</span>

    <form action="${pageContext.request.contextPath}/new/update" method="post">

        <input style="display: none" name="newId" value="${editResult.data.aNew.newId}">

        <div class="form-group">
            <label for="to" class="">标 题:</label>
            <input type="text" name="title" tabindex="1" id="to" class="form-control" value="${editResult.data.aNew.title}">
        </div>
        <div class="form-group">
            <label for="category" class="">类 型:</label>
<%--            <input type="text"  name="categoryId" tabindex="1" id="category" class="form-control"--%>
<%--                   value="${editResult.data.aNew.categoryId}">--%>
            <select name="categoryId" id="category" class="form-control" style="width: auto">
                <option value="1" <c:if test="${editResult.data.aNew.categoryId==1}">selected</c:if> >热点</option>
                <option value="2" <c:if test="${editResult.data.aNew.categoryId==2}">selected</c:if> >娱乐</option>
                <option value="3" <c:if test="${editResult.data.aNew.categoryId==3}">selected</c:if> >科技</option>
                <option value="4" <c:if test="${editResult.data.aNew.categoryId==4}">selected</c:if> >军事</option>
                <option value="5" <c:if test="${editResult.data.aNew.categoryId==5}">selected</c:if> >体育</option>
                <option value="6" <c:if test="${editResult.data.aNew.categoryId==6}">selected</c:if> >国际</option>

            </select>
            <span id="tip_category" style="color: rebeccapurple"></span>
        </div>
        <div class="form-group">
            <label for="dov" class="">作者:</label>
            <input type="text" name="author " tabindex="1" id="dov" class="form-control" value="${editResult.data.user.userName}">
        </div>
        <div class="form-group">
            <label for="do" class="">关键字:</label>
            <input type="text" name="keyWords" tabindex="1" id="do" class="form-control" value="${editResult.data.aNew.keyWords}">
        </div>
        <div id="NewContent" style="display: none">${editResult.data.aNew.content}</div>
        <!-- 加载编辑器的容器 -->
        <script id="container" name="content" type="text/plain">
        </script>

        <button class="btn-theme" id="submit" type="submit"><i class="fa fa-lock"></i>提 交</button>
    </form>
</div>

<!-- 配置文件 -->
<script type="text/javascript" src="${pageContext.request.contextPath}/resource/ueditor/ueditor.config.js" ></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="${pageContext.request.contextPath}/resource/ueditor/ueditor.all.js" ></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container');
    var tsg=document.getElementById('NewContent').innerHTML;
    setTimeout(function () {
        ue.setContent(tsg.toString());
    },500)


</script>


</body>
</html>
